{% extends 'base.html' %}
{% load static %}

{% block head %}
<link rel="stylesheet" href="{% static 'css/global/list.css' %}?v=2">
<link rel="stylesheet" href="{% static 'css/projects/archive.css' %}?v=4">
<link rel="stylesheet" href="{% static 'css/media/projects/archive.css' %}?v=2">
<title>Архив работ</title>
{% endblock head %}

{% block content %}
<form method="post" action="{% url 'archive' %}" class="filters"  id="filter">
    <input type="hidden" name="search_names" value="{% if name_filter_have %}{{ name_filter }}{% endif %}" class="filters-search-input">
    {% csrf_token %}
    <div class="filters-heading">
        <h2 class="filters-title">Фильтры</h2>
        <a href="#" class="filters-link">очистить</a>
    </div>
    <div class="filters-div">
        <button type="button" class="filters-top" onclick="filters_open(this)">
            <h3 class="filters-name">Группа</h3>
            <div class="filters-svg svg-hidden">
                <svg width="16" height="16" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
                    <path
                        d="m114 100 49-49a9.9 9.9 0 0 0-14-14l-49 49-49-49a9.9 9.9 0 0 0-14 14l49 49-49 49a9.9 9.9 0 0 0 14 14l49-49 49 49a9.9 9.9 0 0 0 14-14Z"
                        fill="#5A88FF"></path>
                </svg>
            </div>
        </button>
        <div class="filters-content list-hidden">
            <div class="filters-item filters-search">
                <input type="text" class="filters-input" placeholder="Поиск" onkeyup="filters_search(this)">
                <div class="filters-clear" onclick="filters_clear(this)"></div>
            </div>
            <ul class="filters-list">
                {% for group in groups%}
                <li class="filters-item">
                    <label class="filters-label">
                        <input type="checkbox" name="group_filter" class="filters-checkox group" value="{{group}}">
                        <span class="filters-custom-checkbox"></span>
                        <p class="filters-text">{{group}} группа</p>
                    </label>
                </li>
                {%endfor%}
            </ul>
        </div>
    </div>
    <div class="filters-div">
        <button type="button" class="filters-top" onclick="filters_open(this)">
            <h3 class="filters-name">Уровень проекта</h3>
            <div class="filters-svg svg-hidden">
                <svg width="16" height="16" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
                    <path
                        d="m114 100 49-49a9.9 9.9 0 0 0-14-14l-49 49-49-49a9.9 9.9 0 0 0-14 14l49 49-49 49a9.9 9.9 0 0 0 14 14l49-49 49 49a9.9 9.9 0 0 0 14-14Z"
                        fill="#5A88FF"></path>
                </svg>
            </div>
        </button>
        <div class="filters-content list-hidden">
            <ul class="filters-list">
                <li class="filters-item">
                    <label class="filters-label">
                        <input type="checkbox" name="group_filter" class="filters-checkox" value="noy">
                        <span class="filters-custom-checkbox"></span>
                        <p class="filters-text">НОУ</p>
                    </label>
                </li>
                <li class="filters-item">
                    <label class="filters-label">
                        <input type="checkbox" name="group_filter" class="filters-checkox" value="project">
                        <span class="filters-custom-checkbox"></span>
                        <p class="filters-text">Проект</p>
                    </label>
                </li>
            </ul>
        </div>
    </div>
    <div class="filters-div">
        <button type="button" class="filters-top" onclick="filters_open(this)">
            <h3 class="filters-name">Номинация</h3>
            <div class="filters-svg svg-hidden">
                <svg width="16" height="16" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
                    <path
                        d="m114 100 49-49a9.9 9.9 0 0 0-14-14l-49 49-49-49a9.9 9.9 0 0 0-14 14l49 49-49 49a9.9 9.9 0 0 0 14 14l49-49 49 49a9.9 9.9 0 0 0 14-14Z"
                        fill="#5A88FF"></path>
                </svg>
            </div>
        </button>
        <div class="filters-content list-hidden">
            <div class="filters-item filters-search">
                <input type="text" class="filters-input" placeholder="Поиск" onkeyup="filters_search(this)">
                <div class="filters-clear" onclick="filters_clear(this)"></div>
            </div>
            <ul class="filters-list">
                {% for nomination in nominations %}
                <li class="filters-item">
                    <label class="filters-label">
                        <input type="checkbox" name="nomination_filter" class="filters-checkox" value="{{nomination}}">
                        <span class="filters-custom-checkbox"></span>
                        <p class="filters-text">{{nomination}}</p>
                    </label>
                </li>
                {% endfor %}
            </ul>
        </div>
    </div>
    <div class="filters-div">
        <button type="button" class="filters-top" onclick="filters_open(this)">
            <h3 class="filters-name">Предметная область</h3>
            <div class="filters-svg svg-hidden">
                <svg width="16" height="16" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
                    <path
                        d="m114 100 49-49a9.9 9.9 0 0 0-14-14l-49 49-49-49a9.9 9.9 0 0 0-14 14l49 49-49 49a9.9 9.9 0 0 0 14 14l49-49 49 49a9.9 9.9 0 0 0 14-14Z"
                        fill="#5A88FF"></path>
                </svg>
            </div>
        </button>
        <div class="filters-content list-hidden">
            <div class="filters-item filters-search">
                <input type="text" class="filters-input" placeholder="Поиск" onkeyup="filters_search(this)">
                <div class="filters-clear" onclick="filters_clear(this)"></div>
            </div>
            <ul class="filters-list">
                {% for subject in subjects %}
                <li class="filters-item" onclick="filter()">
                    <label class="filters-label">
                        <input type="checkbox" name="subject_filter" class="filters-checkox subject" value="{{subject}}">
                        <span class="filters-custom-checkbox"></span>
                        <p class="filters-text">{{subject}}</p>
                    </label>
                </li>
                {% endfor %}
            </ul>
        </div>
    </div>
    <button type="submit" class="filters-btn">Применить</button>
</form>
<div class="container">

    <div class="main-nav">
        <input class="search-input" type="text" placeholder="Поиск по проектам" name="search_names"
            value="{% if name_filter_have %}{{ name_filter }}{% endif %}" oninput="search_input_update(this)">
        <button class="search-button" form="filter">
            <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path
                    d="M17.6339 15.8664L14.4607 12.6932C15.1164 11.7051 15.5001 10.522 15.5001 9.25006C15.5001 5.80378 12.6964 3 9.25006 3C5.80378 3 3 5.80378 3 9.25006C3 12.6964 5.80378 15.5001 9.25006 15.5001C10.522 15.5001 11.7051 15.1164 12.6932 14.4607L15.8664 17.6339C16.3539 18.122 17.1464 18.122 17.6339 17.6339C18.122 17.1458 18.122 16.3545 17.6339 15.8664ZM4.87502 9.25006C4.87502 6.83754 6.83754 4.87502 9.25006 4.87502C11.6626 4.87502 13.6251 6.83754 13.6251 9.25006C13.6251 11.6626 11.6626 13.6251 9.25006 13.6251C6.83754 13.6251 4.87502 11.6626 4.87502 9.25006Z"
                    fill="#5a88ff" />
            </svg>
        </button>
    </div>
    {%for project in projects%}
    <div class="block" id="{{project.id}}">
        <div class="block-info">
            <div class="people-div teacher">
                <img src="../../static/img/global/avatar.png" alt="Фото учителя" class="people-img">
                <div class="people-info">
                    <h2 class="people-fio">{{project.teacherPname}}</h2>
                    <span class="people-span">Руководитель проекта</span>
                </div>
            </div>
            <div class="people-div student">
                <img src="../../static/img/global/avatar.png" alt="Фото учителя" class="people-img">
                <div class="people-info">
                    <h2 class="people-fio">{{project.studentPname}}</h2>
                    <span class="people-span">Исполнитель проекта</span>
                </div>
            </div>
            <div class="tags">
                {% for nom in project.nominations %}
                    {% if nom == "Участник районного НОУ" or nom == "Призер районного НОУ" or nom == "Победитель районного НОУ" %}
                    <div class="tag tag1">{{ nom }}</div>
                    {% elif nom == "Участник городского НОУ" or nom == "Призер городского НОУ" or nom == "Победитель городского НОУ" %}
                    <div class="tag tag2">{{ nom }}</div>
                    {% elif nom == "Участник Всероссийского НОУ" or nom == "Призер Всероссийского НОУ" or nom == "Победитель Всероссийского НОУ" %}
                    <div class="tag tag3">{{ nom }}</div>
                    {% endif %}
                {% endfor %}
            </div>
        </div>
        <div class="block-body">
            <h2 class="block-name">{{project.name}} <span class="block-type {% if project.level == 'НОУ' %}noy{% else %} project {% endif %}">{{project.level}}</span></h2>
            <div class="subjects">
                {% for sub in project.subjects %}
                <span class="subject">{{sub}}</span>
                {% endfor %}
            </div>
            <div class="block-content">
                <p class="descr">
                    {{ project.description }}
                </p>

                <ul class="file-list">
                    {% if user.role == "Администратор" or user.username == project.teacherUserName or user.username == project.studentUserName %}
                    <li class="file-item">
                        <label class="file-label docx">
                            <a href="{% url 'download_file' %}?file_id={{project.abstract.id}}" title="Загрузить файл" class="download-link">
                                Реферат
                                <svg height="28px" version="1.1" viewBox="0 0 32 32" width="28px"
                                    xmlns="http://www.w3.org/2000/svg"
                                    xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"
                                    xmlns:xlink="http://www.w3.org/1999/xlink">
                                    <g fill="none" fill-rule="evenodd" stroke="none" stroke-width="1">
                                        <g fill="#1f68e9ba">
                                            <path
                                                d="M19,13 L19,10 L19,10 L13,3 L2.00276013,3 C0.896666251,3 0,3.89833832 0,5.00732994 L0,27.9926701 C0,29.1012878 0.890925393,30 1.99742191,30 L17.0025781,30 C18.1057238,30 19,29.1017876 19,28.0092049 L19,26 L29.0057181,26 C30.6594143,26 32,24.6577357 32,23.0012144 L32,15.9987856 C32,14.3426021 30.6594313,13 29.0057181,13 L19,13 L19,13 L19,13 Z M18,26 L18,28.0066023 C18,28.5550537 17.5523026,29 17.0000398,29 L1.9999602,29 C1.45470893,29 1,28.5543187 1,28.004543 L1,4.99545703 C1,4.45526288 1.44573523,4 1.9955775,4 L12,4 L12,8.99408095 C12,10.1134452 12.8944962,11 13.9979131,11 L18,11 L18,13 L5.99428189,13 C4.34058566,13 3,14.3422643 3,15.9987856 L3,23.0012144 C3,24.6573979 4.3405687,26 5.99428189,26 L18,26 L18,26 L18,26 Z M13,4.5 L13,8.99121523 C13,9.54835167 13.4506511,10 13.9967388,10 L17.6999512,10 L13,4.5 L13,4.5 Z M6.00732994,14 C4.89871223,14 4,14.9001762 4,15.992017 L4,23.007983 C4,24.1081436 4.89833832,25 6.00732994,25 L28.9926701,25 C30.1012878,25 31,24.0998238 31,23.007983 L31,15.992017 C31,14.8918564 30.1016617,14 28.9926701,14 L6.00732994,14 L6.00732994,14 Z M6,16 L6,23 L8.9951185,23 C10.102384,23 11,22.1134452 11,20.9940809 L11,18.0059191 C11,16.8980806 10.1061002,16 8.9951185,16 L6,16 L6,16 Z M7,17 L7,22 L9.00104344,22 C9.55275191,22 10,21.5562834 10,21.0001925 L10,17.9998075 C10,17.4476291 9.55733967,17 9.00104344,17 L7,17 L7,17 Z M14.0048815,16 C12.897616,16 12,16.8865548 12,18.0059191 L12,20.9940809 C12,22.1019194 12.8938998,23 14.0048815,23 L14.9951185,23 C16.102384,23 17,22.1134452 17,20.9940809 L17,18.0059191 C17,16.8980806 16.1061002,16 14.9951185,16 L14.0048815,16 L14.0048815,16 Z M13.9989566,17 C13.4472481,17 13,17.4437166 13,17.9998075 L13,21.0001925 C13,21.5523709 13.4426603,22 13.9989566,22 L15.0010434,22 C15.5527519,22 16,21.5562834 16,21.0001925 L16,17.9998075 C16,17.4476291 15.5573397,17 15.0010434,17 L13.9989566,17 L13.9989566,17 Z M22.9999916,21 C22.9968339,22.1165689 22.1004316,23 20.9951185,23 L20.0048815,23 C18.8938998,23 18,22.1019194 18,20.9940809 L18,18.0059191 C18,16.8865548 18.897616,16 20.0048815,16 L20.9951185,16 C22.1041209,16 22.9968142,16.8948834 22.9999915,18 L22,18 C22,17.4476291 21.5573397,17 21.0010434,17 L19.9989566,17 C19.4472481,17 19,17.4437166 19,17.9998075 L19,21.0001925 C19,21.5523709 19.4426603,22 19.9989566,22 L21.0010434,22 C21.5527519,22 22,21.5562834 22,21.0001925 L22.9999923,21 L22.9999916,21 L22.9999916,21 Z M26,19.5 L24,16 L25,16 L26.5,18.625 L28,16 L29,16 L27,19.5 L29,23 L28,23 L26.5,20.375 L25,23 L24,23 L26,19.5 L26,19.5 Z" />
                                        </g>
                                    </g>
                                </svg>
                            </a>
                        </label>
                    </li>
                    <li class="file-item">
                        <label class="file-label ppt">
                            <a href="{% url 'download_file' %}?file_id={{project.presentation.id}}" title="Загрузить файл" class="download-link">
                                Презентация
                                <svg height="28px" version="1.1" viewBox="0 0 32 32" width="28px"
                                    xmlns="http://www.w3.org/2000/svg"
                                    xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"
                                    xmlns:xlink="http://www.w3.org/1999/xlink">
                                    <g fill="none" fill-rule="evenodd" stroke="none" stroke-width="1">
                                        <g fill="#d5731ee3">
                                            <path
                                                d="M21,13 L21,10 L21,10 L15,3 L4.00276013,3 C2.89666625,3 2,3.89833832 2,5.00732994 L2,27.9926701 C2,29.1012878 2.89092539,30 3.99742191,30 L19.0025781,30 C20.1057238,30 21,29.1017876 21,28.0092049 L21,26 L28.9931517,26 C30.6537881,26 32,24.6577357 32,23.0012144 L32,15.9987856 C32,14.3426021 30.6640085,13 28.9931517,13 L21,13 L21,13 L21,13 Z M20,26 L20,28.0066023 C20,28.5550537 19.5523026,29 19.0000398,29 L3.9999602,29 C3.45470893,29 3,28.5543187 3,28.004543 L3,4.99545703 C3,4.45526288 3.44573523,4 3.9955775,4 L14,4 L14,8.99408095 C14,10.1134452 14.8944962,11 15.9979131,11 L20,11 L20,13 L12.0068483,13 C10.3462119,13 9,14.3422643 9,15.9987856 L9,23.0012144 C9,24.6573979 10.3359915,26 12.0068483,26 L20,26 L20,26 L20,26 Z M15,4.5 L15,8.99121523 C15,9.54835167 15.4506511,10 15.9967388,10 L19.6999512,10 L15,4.5 L15,4.5 Z M11.9945615,14 C10.8929956,14 10,14.9001762 10,15.992017 L10,23.007983 C10,24.1081436 10.9023438,25 11.9945615,25 L29.0054385,25 C30.1070044,25 31,24.0998238 31,23.007983 L31,15.992017 C31,14.8918564 30.0976562,14 29.0054385,14 L11.9945615,14 L11.9945615,14 Z M18,18 L18,23 L19,23 L19,20 L20.9951185,20 C22.102384,20 23,19.1122704 23,18 C23,16.8954305 22.1061002,16 20.9951185,16 L18,16 L18,18 L18,18 Z M19,17 L19,19 L21.0010434,19 C21.5527519,19 22,18.5561352 22,18 C22,17.4477153 21.5573397,17 21.0010434,17 L19,17 L19,17 Z M12,18 L12,23 L13,23 L13,20 L14.9951185,20 C16.102384,20 17,19.1122704 17,18 C17,16.8954305 16.1061002,16 14.9951185,16 L12,16 L12,18 L12,18 Z M13,17 L13,19 L15.0010434,19 C15.5527519,19 16,18.5561352 16,18 C16,17.4477153 15.5573397,17 15.0010434,17 L13,17 L13,17 Z M26,17 L26,23 L27,23 L27,17 L29,17 L29,16 L24,16 L24,17 L26,17 L26,17 Z" />
                                        </g>
                                    </g>
                                </svg>
                            </a>
                        </label>
                    </li>
                    <li class="file-item">
                        <label class="file-label txt">
                            <a href="{% url 'download_file' %}?file_id={{project.annotation.id}}" title="Загрузить файл" class="download-link">
                                Аннотация
                                <svg height="28px" version="1.1" viewBox="0 0 32 32" width="28px"
                                    xmlns="http://www.w3.org/2000/svg"
                                    xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"
                                    xmlns:xlink="http://www.w3.org/1999/xlink">
                                    <g fill="none" fill-rule="evenodd" stroke="none" stroke-width="1">
                                        <g fill="#929292">
                                            <path
                                                d="M19.5,3 L9.00276013,3 C7.89666625,3 7,3.89833832 7,5.00732994 L7,27.9926701 C7,29.1012878 7.89092539,30 8.99742191,30 L24.0025781,30 C25.1057238,30 26,29.1017876 26,28.0092049 L26,10.5 L26,10 L20,3 L19.5,3 L19.5,3 L19.5,3 Z M19,4 L8.9955775,4 C8.44573523,4 8,4.45526288 8,4.99545703 L8,28.004543 C8,28.5543187 8.45470893,29 8.9999602,29 L24.0000398,29 C24.5523026,29 25,28.5550537 25,28.0066023 L25,11 L20.9979131,11 C19.8944962,11 19,10.1134452 19,8.99408095 L19,4 L19,4 Z M20,4.5 L20,8.99121523 C20,9.54835167 20.4506511,10 20.9967388,10 L24.6999512,10 L20,4.5 L20,4.5 Z M10,10 L10,11 L15,11 L15,10 L10,10 L10,10 Z M10,7 L10,8 L17,8 L17,7 L10,7 L10,7 Z M10,13 L10,14 L23,14 L23,13 L10,13 L10,13 Z M10,16 L10,17 L20,17 L20,16 L10,16 L10,16 Z M10,19 L10,20 L23,20 L23,19 L10,19 L10,19 Z M10,22 L10,23 L19,23 L19,22 L10,22 L10,22 Z M10,25 L10,26 L23,26 L23,25 L10,25 L10,25 Z" />
                                        </g>
                                    </g>
                                </svg>
                            </a>
                        </label>
                    </li>
                    {% endif %}
                    <li class="file-item">
                        <label class="file-label video">
                            <button href="{{project.defence_video}}" title="Открыть видео" class="video-btn">
                                Видео
                                <svg enable-background="new 0 0 32 32" height="28px" id="Layer_1" version="1.1" viewBox="0 0 24 24" width="28px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#b53e3e"><path d="M23.2,6c-0.2-0.1-0.4-0.1-0.5,0l-3.5,2.7V7.5c0-1.6-1.3-2.9-2.9-2.9H3.4c-1.6,0-2.9,1.3-2.9,2.9v9c0,1.6,1.3,2.9,2.9,2.9  h12.9c1.6,0,2.9-1.3,2.9-2.9v-1.2l3.5,2.7c0.1,0.1,0.3,0.1,0.5,0c0.2-0.1,0.3-0.2,0.3-0.4V6.4C23.5,6.2,23.4,6.1,23.2,6z"/></svg>
                            </button>
                        </label>
                    </li>
                </ul>
            </div>
        </div>
        <div class="block-more" onclick="block_open({{project.id}}, this)">
            Подробнее
        </div>
    </div>
{%endfor%}
</div>
<script src="{% static 'js/projects/archive.js' %}?v=1"></script>
<script>
    let has_real_time_input = {% if user.role == 'Учитель' %} true {% else %} false {% endif %};
</script>
{% endblock %}